<#assign x=0 />
<#macro showlist list>
<#if list?exists && list?size gt 0>
     <table>
     <#list list as li>
     	<#assign x=x+1 />
     	<tr id="${li.id}"><td class="<#if x%2!=0>odd</#if>"><h2><input type="checkbox" value="${li.id}" />${li.title}</h2>
     	<#if li.childPrivileges?exists && li.childPrivileges?size gt 0>
     		<ul><#list li.childPrivileges as privilege><li><input type="checkbox" <#if privileges?seq_contains(privilege.id)>checked="checked"</#if> value="${privilege.id}" name="privilege"/>${privilege.title}</li></#list></ul>
     	</#if>
     	</td><td><@showlist list=li.childCatalogs/></td></tr>     	
	 </#list>
	 <#if list?size%2!=0><#assign x=x+1 /></#if>
	 </table>
 </#if>
</#macro>
<div class="privileges">
<#if catalog.childCatalogs?exists && catalog.childCatalogs?size gt 0>
     <table><tr>
     <#list catalog.childCatalogs as li>
     	<#assign x=x+1 />
     	<td class="<#if x%2!=0>odd</#if>"><h2><input type="checkbox" value="${li.id}" />${li.title}</h2>
     	<#if li.childPrivileges?exists && li.childPrivileges?size gt 0>
     		<ul><#list li.childPrivileges as privilege><li><input type="checkbox" <#if privileges?seq_contains(privilege.id)>checked="checked"</#if> value="${privilege.id}" name="privilege" />${privilege.title}</li></#list></ul>
     	</#if>
     	</td><td><div id="${li.id}"><@showlist list=li.childCatalogs/></div></td> 	
	 </#list></tr><#if catalog.childCatalogs?size%2!=0><#assign x=x+1 /></#if></table>
 </#if>
</div>
 